<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateChannelsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('channels', function (Blueprint $table) {
            $table->id();
            $table->string('name');
            $table->unsignedSmallInteger('rate')->default(0)->comment('费率 0-1000 需要 除以1000计算 按照千分来计算');
            $table->string('gateway')->comment('支付网关');
            $table->string('mode')->default(\App\Models\Channel::MODE_NORMAL)->comment('支付模式');
            $table->string('status')->default(\App\Models\Channel::STATUS_NORMAL)->comment('状态');
            $table->string('method')->nullable()->comment('支付方式');
            $table->string('mch_id')->nullable()->comment('微信商户id qq商户id 支付宝appid');
            $table->string('mch_key')->nullable()->comment('商户key');
            $table->string('mp_appid')->nullable()->comment('微信公众号appid');
            $table->string('mp_secret')->nullable()->comment('微信公众号secret');
            $table->string('mini_appid')->nullable()->comment('小程序APPID');
            $table->string('mini_secret')->nullable()->comment('小程序Secret');
            $table->text('public_key')->nullable()->comment('支付宝公钥');
            $table->text('private_key')->nullable()->comment('支付宝商户私钥');
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('channels');
    }
}
